<template>
    <div class="member-order-list">
        <div v-if="!utils.getIsApp()" class="common-header-wrap">
            <mt-header title="订单修改" class="common-header">
                <mt-button slot="left" icon="back" @click="$router.go(-1)"></mt-button>
            </mt-header>
        </div>
        <div class="submit-meal">
            <div class="submit-meal-title">联系人信息</div>
            <div class="submit-information-list">
                <div class="information-title">姓名</div>
                <input class="information-input" v-model="username" placeholder="请填写联系人姓名">
            </div>
            <div class="submit-information-list">
                <div class="information-title">手机</div>
                <input class="information-input" type="number" v-model="usermobile" value="" placeholder="请填写联系人手机号码">
            </div>
        </div>
        <div class="submit-meal">
            <div class="submit-meal-title">备注</div>
            <textarea class="submit-remarks" v-model="remarks" placeholder="1、若选择“团体”出游请在此填写人数，如：成人4人,儿童2人
2、在此描述您的旅行需求，如需发票请备注。"></textarea>
        </div>

        <div class="order-edit-btn" @click="getTravelorderedit">确认修改</div>
    </div>
</template>

<script>
    import {getTravelorderedit,getTravelorderdetail} from '../../../api/travel'
    import {Toast, MessageBox, Indicator} from 'mint-ui'
    import {mapState} from 'vuex'

    export default {

        name: 'TeatravelOrderEdit',
        data() {
            return {
                username:'',
                usermobile:'',
                remarks:''
            }
        },

        mounted() {
          this.getTravelorderdetail();
        },

        methods: {
          // 获取订单详情
            getTravelorderdetail(){
                getTravelorderdetail(this.$route.query.id).then(res=>{
                    this.username=res.result.shot_lists.name
                    this.usermobile=res.result.shot_lists.mobile
                    this.remarks=res.result.shot_lists.remark
                }).catch(function (error) {
                    Toast(error.message)
                })
            },

          //修改订单
            getTravelorderedit(){
                if(this.username==''||this.usermobile==''){
                    Toast('姓名和联系方式不能为空!')
                    return;
                }
                getTravelorderedit(this.$route.query.id,this.username,this.usermobile,this.remarks).then(res=>{
                    Toast('修改成功！')
                    setTimeout(()=>{
                        this.$router.go(-1)
                    },1500)
                }).catch(function (error) {
                    Toast(error.message)
                })
            }
        }
    }
</script>
<style lang="scss" scoped>
    .submit-meal {
        margin-top: 10px;
        background: white;
        padding: 10px 25px;

        .submit-meal-title {
            font-size: .7rem;
            font-weight: bold;
            span{
                color: #B5B5B5;
                font-size: .5rem;
                margin-left: 5px;
            }
        }

        .submit-meal-body {
            display: flex;
            flex-direction: row;
            flex-wrap: wrap;

            .submit-meal-list {
                margin-top: 10px;
                margin-right: 15px;
                width: 140px;
                text-align: center;
                padding: 4px 0;
                font-size: .6rem;
                background: #EEEFF2;
                border-radius: 100px;
            }

            .submit-people-list {
                margin-top: 10px;
                margin-right: 15px;
                width: 80px;
                text-align: center;
                padding: 4px 0;
                font-size: .6rem;
                background: #EEEFF2;
                border-radius: 100px;
            }

            .active {
                background: $primaryColor;
                color: white;
            }
        }
        .submit-information-list{
            margin-top: 10px;
            display: flex;
            flex-direction: row;
            align-items: center;
            .information-title{
                font-size: .6rem;
                margin-right: 20px;
            }
            .information-input{
                border: none;
            }
        }
        .submit-remarks{
            width: 100%;
            height: 80px;
        }
    }
    .order-edit-btn{
        width: 80vw;
        margin: auto;
        margin-top: 10vw;
        height: 38px;
        line-height: 38px;
        font-size: .8rem;
        font-weight:bold;
        color: white;
        background: $primaryColor;
        text-align: center;
        border-radius:5px;
    }
</style>
